package com.fowo.api.sys.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.dialect.IDialect;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.dialect.SpringStandardDialect;
import org.thymeleaf.templateresolver.StringTemplateResolver;

@Configuration
public class MailConfig {
    @Bean("mailTemplateEngine")
    public SpringTemplateEngine mailTemplateEngine() {
        SpringTemplateEngine stringTemplateEngine = new SpringTemplateEngine();
        IDialect dialect = new SpringStandardDialect();
        stringTemplateEngine.setDialect(dialect);
        StringTemplateResolver resolver = new StringTemplateResolver();
        resolver.setCacheable(true);
        stringTemplateEngine.setTemplateResolver(resolver);
        return stringTemplateEngine;
    }
}
